<template>
  <div>
      <h1>{{title}}</h1>
      <h1>{{msg}}</h1>
      <h1 @click="$emit('childClick',msg)">提示</h1>
      <button @click='sendMsg()'>发送Child组建的消息</button>
  </div>
</template>

<script>
import {ref} from 'vue'
import bus from "vue3-eventbus"
export default {
    props:{
        title:String
    },
    setup(){
        const msg = ref("我是子组件的值")
        const sendMsg = ()=>{
            console.log('发送Child组建的消息')
            bus.emit('getMsg','我是来自Child组建的消息')
        }
        return{
            msg,
            sendMsg
        }
    }
}
</script>

<style>

</style>